You can download the raw source code for these lecture notes here.
Again, you will want to download a new version of
compmus.R this week. You should also check make sure that
you have the signal package installed, which is necessary
for generating tempograms. You do not need to load it explicitly, but
the new functions in compmus.R will complain if it is not
installed. Use Install Packages (under the Tools menu) in RStudio to
install it.
library(tidyverse)
## โโ Attaching core tidyverse packages โโโโโโโโโโโโโโโโโโโโโโโโ tidyverse 2.0.0 โโ
## โ dplyr 1.1.4 โ readr 2.1.5
## โ forcats 1.0.0 โ stringr 1.5.1
## โ ggplot2 3.5.1 โ tibble 3.2.1
## โ lubridate 1.9.4 โ tidyr 1.3.1
## โ purrr 1.0.4
## โโ Conflicts โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ tidyverse_conflicts() โโ
## โ dplyr::filter() masks stats::filter()
## โ dplyr::lag() masks stats::lag()
## โน Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
source("compmus.R")
Look at one (or more) of the self-similarity matrices from somebodyโs portfolio in your group. Discuss what you think a spectrum-based novelty function would look like for this track. Listen to (some of) the track and also discussion what you think an energy-based novelty function would look like. Which one do you think would be most useful for beat tracking, and why?
We can compute an energy-based novelty function based on Essentiaโs
loudness estimates. Try the compmus_energy_novelty()
function on several files in the class corpus. How well do they seem to
work?
"features/ahram-j-1.json" |>
compmus_energy_novelty() |>
ggplot(aes(t, novelty)) +
geom_line() +
theme_minimal() +
labs(x = "Time (s)", y = "Energy Novelty")
We can use similar approaches for cepstrograms to get an
approximation to spectral novelty, with the
compmus_spectral_novelty() function. Do you find the
novelty functions using this approximation to be more or less helpful
than the energy novelty?
"features/ahram-j-1.json" |>
compmus_spectral_novelty() |>
ggplot(aes(t, novelty)) +
geom_line() +
theme_minimal() +
labs(x = "Time (s)", y = "Spectral Novelty")
The new compmus_tempogram() function generates a
Fourier-based tempogram from Essentiaโs estimates of beat location and
beat loudness, ready to plot with geom_raster(). Be warned
that computing tempograms can be slow! Try increasing the window size
and hop size if you find that you are waiting too long.
"features/ahram-j-1.json" |>
compmus_tempogram(window_size = 8, hop_size = 1, cyclic = FALSE) |>
ggplot(aes(x = time, y = bpm, fill = power)) +
geom_raster() +
scale_fill_viridis_c(guide = "none") +
labs(x = "Time (s)", y = "Tempo (BPM)") +
theme_classic()
## `summarise()` has grouped output by 'time'. You can override using the
## `.groups` argument.
The textbook notes that Fourier-based tempograms tend to pick up strongly on tempo harmonics. Wrapping into a cyclic tempogram can be more informative.
"features/ahram-j-1.json" |>
compmus_tempogram(window_size = 8, hop_size = 1, cyclic = TRUE) |>
ggplot(aes(x = time, y = bpm, fill = power)) +
geom_raster() +
scale_fill_viridis_c(guide = "none") +
labs(x = "Time (s)", y = "Tempo (BPM)") +
theme_classic()
## `summarise()` has grouped output by 'time'. You can override using the
## `.groups` argument.
Return to the track you discussed in Breakout 1 (or choose a new track that somebody in your group loves). Compute regular and cyclic tempograms for this track. - How well do they work? - Do you see more tempo harmonics or more tempo sub-harmonics? Is that what you expected? Why? - Try other tracks as time permits, and be prepared to share your most interesting tempogram with the class.